Skip to content

Fix: detail view formatter to display column titles instead of field names#572

Merged
wenzhixin merged 2 commits intodevelopfrom
feature/detail-view-formatter-fix
Mar 29, 2026
Merged

Fix: detail view formatter to display column titles instead of field names#572
wenzhixin merged 2 commits intodevelopfrom
feature/detail-view-formatter-fix

Conversation

@wenzhixin
Copy link
Copy Markdown
Owner

@wenzhixin wenzhixin commented Mar 29, 2026

Fixes #319

Summary

  • Update detail view formatter to display human-readable column titles instead of raw field names
  • Add safe handling for fields that don't have a corresponding column definition

Changes

  • Modified detailFormatter in options/detail-view.html to lookup column titles from the table configuration
  • Added getTitle helper function that safely returns the column title or falls back to the field name

Test plan

  • Verified detail view displays ID, Item Name, Item Price instead of id, name, price
  • Verified no errors when row contains fields not in column definition (e.g., amount)

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the detail-view example formatter so the expanded row displays human-readable column titles (e.g., “Item Name”) instead of raw field keys (e.g., name), with a fallback when no matching column exists.

Changes:

  • Look up column metadata via bootstrapTable('getOptions').columns inside detailFormatter
  • Add getTitle helper to resolve a field key to its column title (fallback to key)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread options/detail-view.html Outdated
@wenzhixin
Copy link
Copy Markdown
Owner Author

@copilot apply changes based on the comments in this thread

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 29, 2026

@copilot apply changes based on the comments in this thread

Applied in bf1494c. The getTitle function now:

  • Guards against a missing/empty columns array before searching
  • Uses flatMap to flatten all column rows (not just columns[0]), so leaf columns in grouped/multi-row headers at any depth are correctly resolved
  • Renames the find callback parameter to col to avoid shadowing the outer column variable

@wenzhixin wenzhixin force-pushed the feature/detail-view-formatter-fix branch from bf1494c to fe9e23a Compare March 29, 2026 10:33
@wenzhixin wenzhixin merged commit 52d2bd6 into develop Mar 29, 2026
1 check passed
@wenzhixin wenzhixin deleted the feature/detail-view-formatter-fix branch March 29, 2026 10:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Question DetailView Use Header Names Not DataFieldId

3 participants